# -*- coding: UTF-8 -*-
from Tkinter import *
import ttk
import time
import math



def createova():
    global iz
    iz+=1
    if iz<90:
        if iz%2==0:
            c.create_oval((270-iz*5),30,320+iz*5,50+iz*5,outline='red')
            c.create_oval((270-iz*5),30,320+iz*5,100+iz*5,outline='red')

        else:
            c.create_oval((270-iz*5),30,320+iz*5,50+iz*5,outline='blue')
            c.create_oval((270-iz*5),30,320+iz*5,100+iz*5,outline='red')
        root.after(500,createova)


def ll():
    global day
    if day<2800:
        pi=3.1415
        r1=300
        r2=216
        jd1=2*pi/365.2
        x1=400+math.sin(jd1*day)*r1
        y1=400-math.cos(jd1*day)*r1
        jd2=2*pi/224.7
        x2=400+math.sin(jd2*day)*r2
        y2=400-math.cos(jd2*day)*r2
        c.create_line(x1,y1,x2,y2,fill='red')
        c.coords(dq,((x1-5),(y1-5),(x1+5),(y1+5)))
        c.coords(jx,((x2-5),(y2-5),(x2+5),(y2+5)))
        day+=4
        print day
        root.after(10,ll)
        
    else:
        day=0
        c.delete('all')
        root.after(10,ll)
    #else:c.create_oval(300,300,500,500,fill='red')



day=0
root=Tk()
iz=0
rz1=300
rz2=216
c=Canvas(root,bg="white",width=800,height=800)
c.grid(row=0,column=0)
c.create_oval(350,350,450,450,fill='yellow')
dq=c.create_oval(295,295,305,305,fill='blue')
jx=c.create_oval(211,211,221,221,fill='red')
ll()
#createova()
root.mainloop()

